<template>
	<view class="page">
		<!-- 推广码 -->
		<view class="vip-info">
			<view class="vip">
				<view class="vip1">
					<text>总收益金额</text>
					<view class="money">
						800
					</view>
				</view>
				<view class="vip-btn" @click="show1=true">
					<text>我的推广码</text>
				</view>
			</view>
			<view class="shouyi">
				<view class="today">
					今日收益：0元
				</view>
				<view class="yesterday">
					昨日收益：0元
				</view>
			</view>
		</view>
		<view class="shanghu">
			<text>管理的商户：4</text>
		</view>
		<view class="shouyi1">
			<text>收益来源</text>
			<view class="year" @click="show=true">
				{{ formattedDate }}
			</view>
		</view>
		<view class="shouyi-details" v-for="(item, index) in 3" :key="index">
			<view class="title">
				<view class="title-item1">
					商户入驻二爷
				</view>
				<view class="title-item2">
					2024-08-03 16:15:51
				</view>
			</view>
			<view class="title1">
				+80
			</view>
		</view>
		<u-datetime-picker :show="show" v-model="value1" mode="year-month" @close="close"
			@confirm="submit"></u-datetime-picker>
		<!-- 推广码弹框 -->
		<u-popup :show="show1" :round="10" mode="center" @close="close1" @open="open1">
			<view class="popup-content">
				<image style="width: 500rpx; height: 500rpx;" src="/static/tuiguangma.png"></image>

			</view>
		</u-popup>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				value1: '',
				show1: false, // 控制弹框的显示与隐藏
			}
		},
		computed: {
			formattedDate() {
				if (!this.value1) {
					return '请选择月份';
				}
				const date = new Date(this.value1);
				const year = date.getFullYear();
				const month = date.getMonth() + 1; // 获取月份，注意要加 1
				return `${year}-${month < 10 ? '0' + month : month}`; // 格式化为 年-月
			}
		},
		methods: {
			close() {
				this.show = false; // 关闭选择器
			},
			submit() {
				this.show = false; // 选择日期后关闭选择器
				// 可添加额外的逻辑
			},
			open1() {
				// this.show1 = false
			},
			close1() {
				this.show1 = false

			},

		}
	}
</script>

<style scoped lang="scss">
	@import 'agent.scss';
</style>